#include <iostream>
#include <iostream>
#include <string>
#include <sstream> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		string str1, str2;
		cin >> str2 >> str1;
		int count = 0,ans = str1.find(str2, 0);
		while (ans!=-1)
		{	
			count++;
			ans = str1.find(str2,ans+1);
		}
		cout << count << endl;
	}
	return 0;
}